{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=2996
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var   
	i,j,n,k:longint;
	a:array[0..1000010] of int64;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n,k);
a[1]:=2;
for i:=2 to k do
	a[i]:=a[i-1] shl 1;
dec(a[k]);
for i:=k+1 to n do
	for j:=1 to k do
		inc(a[i],a[i-j]);
write(a[n]);
end.